#ifndef Gen_MSG_CALLABLE_H_
#define Gen_MSG_CALLABLE_H_
#include <boost/shared_ptr.hpp>
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/protocol/TDebugProtocol.h>
#include <thrift/transport/TSocket.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/transport/THttpClient.h>
#include <thrift/TProcessor.h>
#include <glog/logging.h>
#include "gen-cpp/ChatService.h"
#include "client/RequestQueue.h"
namespace at = apache::thrift;
namespace atp = apache::thrift::protocol;
namespace att = apache::thrift::transport;

namespace client {
  class GenMsgCallable {
 public:
 GenMsgCallable(uint64_t clientID) : clientID_(clientID) {
    }
    void operator()() {
      while (true) {
        sleep(rand() % 8);
        int type = rand() % 2;
        type = 0;
        if (type == 0) {
          chat::SendMsgReq req;
          req.toid = rand() % 4;
          req.fromid = clientID_;
          req.msg = "haha";
          RequestQueue::Instance()->Schedule(req);
        }
        else {
          chat::SendEmptyRequestReq req;
          RequestQueue::Instance()->Schedule(req);
        }
      }
    }
 private:
    uint64_t clientID_;
  };
}
#endif
